<?php
include '../Config/config.php';
include '../Config/conexion.php';
include_once '../Model/Revisor.php';

$revisores = Revisor::Listar();

$titulo_page = 'Subir Papers';
include_once '../Shared/header.php';
?>
<div class="container">
	<?php $tituloMenu  = htmlentities(utf8_decode("Gestión de Revisores"));?>
	<?php include_once '../Shared/Menu.php'?>
</div>
<div class="container">
<div>
</div>
</div>

<script type="text/javascript">
	
	function Eliminar(IdRevisor){
		$("#formuProceso").find("#revisor_id").val(IdRevisor);
		document.getElementById("formuProceso").submit();
	}
	
	$(document).ready(function(){
		//Eliminar
		$("img[revisor_id]").click(function(){
			if(!confirm("Desea Eliminar este revisor")){
					return false;	
				}
			var obj = $(this);
			Eliminar(obj.attr("revisor_id"));
		});
		
		//Enviar Mail
		$("span[idrevisor]").click(function (){
			if(!confirm("Desea Enviar los datos a este revisor")){
				return false;
			}
			var obj = $(this);
			$("#formuEnviarDatos").find("#revisor_id").val(obj.attr("idrevisor"));			
			$("#formuEnviarDatos").submit();
		});
	});
	

</script>

<form action="EnviarDatos.php" method="post" name="formuEnviarDatos" id="formuEnviarDatos">
	<input type="hidden" id="revisor_id" name="revisor_id"/>   	
</form>


<form action="Proceso.php" method="post" name="formuProceso" id="formuProceso">
	<input type="hidden" id="revisor_id" name="revisor_id"/>
   	<input type="hidden" name="eliminar" id="eliminar" value="1"/>
</form>

<div class="container">	
	<div class="prepend-1 span-6 last">
		<a href="#" onclick="window.location.href='FormuRevisor.php'">
			<img src="<?php echo INI_URL?>/Content/images/web/16_add.png "> Nuevo
		</a>
	</div>
</div>

<div class="container">
<table class="tabla-basica">
<thead>
<tr>
    <th>NO</th>
    <th>Revisor</th>
    <th>Pa&iacute;s</th>
    <th>E-mail</th>
    <th>Institucion</th>
	<th></th>
</tr>
</thead>
<?php
$cont=1;
$i = 0;
foreach($revisores as $row){
	?>
	<tr class="row<?php echo ($i++)%2; ?>">
	<?php
	echo '<td>'.$cont.'</td>';
	echo '<td>'.$row->revisor.'</td>';
	echo '<td>'.$row->pais.'</td>';
	echo '<td>'.$row->email.'</td>';
	echo '<td>'.$row->institucion.'</td>';
	?>
	<td>
    	<a href="FormuRevisor.php?idrevisor=<?php echo $row->revisor_id?>">
			<img src="<?php echo INI_URL?>/Content/images/web/editar.png" />
        </a>
		<!--
        <img src="<?php echo INI_URL?>/Content/images/web/16_delete.png"  revisor_id="<?php echo $row->revisor_id?>"/>
        -->
		<span idrevisor="<?php echo $row->revisor_id;?>">Enviar</span>
	</td>
	<?php
	echo '</tr>';	
	$cont++;	
}
?>
</table>
</div>
<?php 
include_once '../Shared/footer.php';
?>